package com.gzy.cbrsystem.shimian.dao;

import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

/**
 * A data access object (DAO) providing persistence and search support for
 * ShimianMjjy entities. Transaction control of the save(), update() and
 * delete() operations can directly support Spring container-managed
 * transactions or they can be augmented to handle user-managed Spring
 * transactions. Each of these methods provides additional information for how
 * to configure it for the desired type of transaction control.
 * 
 * @see com.gzy.cbrsystem.shimian.dao.ShimianMjjy
 * @author MyEclipse Persistence Tools
 */

public class ShimianMjjyDAO extends HibernateDaoSupport {
	private static final Log log = LogFactory.getLog(ShimianMjjyDAO.class);
	// property constants
	public static final String ZJXM = "zjxm";
	public static final String JYLY = "jyly";
	public static final String SYZ_BS = "syzBs";
	public static final String SYZ_ZZTD = "syzZztd";
	public static final String SYZ_QTZZ = "syzQtzz";
	public static final String JBZD_ZY = "jbzdZy";
	public static final String JBZD_XY = "jbzdXy";
	public static final String JBZD_QT = "jbzdQt";
	public static final String ZYBZ_BZJD = "zybzBzjd";
	public static final String ZYBZ_ZHTD = "zybzZhtd";
	public static final String ZYBZ_BZXSYJ = "zybzBzxsyj";
	public static final String GYFA_GYMB = "gyfaGymb";
	public static final String GYFA_ZZZF = "gyfaZzzf";
	public static final String GYFA_GYCS = "gyfaGycs";
	public static final String GYFA_CF = "gyfaCf";
	public static final String GYFA_LC = "gyfaLc";
	public static final String GYFA_TZBH = "gyfaTzbh";
	public static final String XYZB_ZYJJZB = "xyzbZyjjzb";
	public static final String XYZB_CYJJZB = "xyzbCyjjzb";
	public static final String BLFY = "blfy";
	public static final String QTZYSX = "qtzysx";

	protected void initDao() {
		// do nothing
	}

	public void save(ShimianMjjy transientInstance) {
		log.debug("saving ShimianMjjy instance");
		try {
			getHibernateTemplate().save(transientInstance);
			log.debug("save successful");
		} catch (RuntimeException re) {
			log.error("save failed", re);
			throw re;
		}
	}

	public void delete(ShimianMjjy persistentInstance) {
		log.debug("deleting ShimianMjjy instance");
		try {
			getHibernateTemplate().delete(persistentInstance);
			log.debug("delete successful");
		} catch (RuntimeException re) {
			log.error("delete failed", re);
			throw re;
		}
	}

	public ShimianMjjy findById(java.lang.String id) {
		log.debug("getting ShimianMjjy instance with id: " + id);
		try {
			ShimianMjjy instance = (ShimianMjjy) getHibernateTemplate().get(
					"com.gzy.cbrsystem.shimian.dao.ShimianMjjy", id);
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}

	public List findByExample(ShimianMjjy instance) {
		log.debug("finding ShimianMjjy instance by example");
		try {
			List results = getHibernateTemplate().findByExample(instance);
			log.debug("find by example successful, result size: "
					+ results.size());
			return results;
		} catch (RuntimeException re) {
			log.error("find by example failed", re);
			throw re;
		}
	}

	public List findByProperty(String propertyName, Object value) {
		log.debug("finding ShimianMjjy instance with property: " + propertyName
				+ ", value: " + value);
		try {
			String queryString = "from ShimianMjjy as model where model."
					+ propertyName + "= ?";
			return getHibernateTemplate().find(queryString, value);
		} catch (RuntimeException re) {
			log.error("find by property name failed", re);
			throw re;
		}
	}

	public List findByZjxm(Object zjxm) {
		return findByProperty(ZJXM, zjxm);
	}

	public List findByJyly(Object jyly) {
		return findByProperty(JYLY, jyly);
	}

	public List findBySyzBs(Object syzBs) {
		return findByProperty(SYZ_BS, syzBs);
	}

	public List findBySyzZztd(Object syzZztd) {
		return findByProperty(SYZ_ZZTD, syzZztd);
	}

	public List findBySyzQtzz(Object syzQtzz) {
		return findByProperty(SYZ_QTZZ, syzQtzz);
	}

	public List findByJbzdZy(Object jbzdZy) {
		return findByProperty(JBZD_ZY, jbzdZy);
	}

	public List findByJbzdXy(Object jbzdXy) {
		return findByProperty(JBZD_XY, jbzdXy);
	}

	public List findByJbzdQt(Object jbzdQt) {
		return findByProperty(JBZD_QT, jbzdQt);
	}

	public List findByZybzBzjd(Object zybzBzjd) {
		return findByProperty(ZYBZ_BZJD, zybzBzjd);
	}

	public List findByZybzZhtd(Object zybzZhtd) {
		return findByProperty(ZYBZ_ZHTD, zybzZhtd);
	}

	public List findByZybzBzxsyj(Object zybzBzxsyj) {
		return findByProperty(ZYBZ_BZXSYJ, zybzBzxsyj);
	}

	public List findByGyfaGymb(Object gyfaGymb) {
		return findByProperty(GYFA_GYMB, gyfaGymb);
	}

	public List findByGyfaZzzf(Object gyfaZzzf) {
		return findByProperty(GYFA_ZZZF, gyfaZzzf);
	}

	public List findByGyfaGycs(Object gyfaGycs) {
		return findByProperty(GYFA_GYCS, gyfaGycs);
	}

	public List findByGyfaCf(Object gyfaCf) {
		return findByProperty(GYFA_CF, gyfaCf);
	}

	public List findByGyfaLc(Object gyfaLc) {
		return findByProperty(GYFA_LC, gyfaLc);
	}

	public List findByGyfaTzbh(Object gyfaTzbh) {
		return findByProperty(GYFA_TZBH, gyfaTzbh);
	}

	public List findByXyzbZyjjzb(Object xyzbZyjjzb) {
		return findByProperty(XYZB_ZYJJZB, xyzbZyjjzb);
	}

	public List findByXyzbCyjjzb(Object xyzbCyjjzb) {
		return findByProperty(XYZB_CYJJZB, xyzbCyjjzb);
	}

	public List findByBlfy(Object blfy) {
		return findByProperty(BLFY, blfy);
	}

	public List findByQtzysx(Object qtzysx) {
		return findByProperty(QTZYSX, qtzysx);
	}

	public List findAll() {
		log.debug("finding all ShimianMjjy instances");
		try {
			String queryString = "from ShimianMjjy";
			return getHibernateTemplate().find(queryString);
		} catch (RuntimeException re) {
			log.error("find all failed", re);
			throw re;
		}
	}

	public ShimianMjjy merge(ShimianMjjy detachedInstance) {
		log.debug("merging ShimianMjjy instance");
		try {
			ShimianMjjy result = (ShimianMjjy) getHibernateTemplate().merge(
					detachedInstance);
			log.debug("merge successful");
			return result;
		} catch (RuntimeException re) {
			log.error("merge failed", re);
			throw re;
		}
	}

	public void attachDirty(ShimianMjjy instance) {
		log.debug("attaching dirty ShimianMjjy instance");
		try {
			getHibernateTemplate().saveOrUpdate(instance);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}

	public void attachClean(ShimianMjjy instance) {
		log.debug("attaching clean ShimianMjjy instance");
		try {
			getHibernateTemplate().lock(instance, LockMode.NONE);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}

	public static ShimianMjjyDAO getFromApplicationContext(
			ApplicationContext ctx) {
		return (ShimianMjjyDAO) ctx.getBean("ShimianMjjyDAO");
	}
}